package cn.io1;

import java.io.*;

public class Test03 {
    /*
    * 缓冲流
    * */
    public static void main(String[] args) {
        long start = System.currentTimeMillis();
        try (
            BufferedInputStream bis = new BufferedInputStream(new FileInputStream("/media/ke666/inst_25/iso/CentOS-7-x86_64-Minimal-2207-02.iso"));
            BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("/media/ke666/inst_25/iso/CentOS-7-x86_64-Minimal-2207-0222.iso"))
        ){
            byte[] bytes = new byte[8*1024];
            int len;
            while ((len=bis.read(bytes))!=-1){
                bos.write(bytes,0,len);
            }
            long end = System.currentTimeMillis()-start;
            System.out.println("success,耗时="+end);
        }catch (IOException e){
            e.printStackTrace();
        }
    }
}
